home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / mac / Photoshop 4.0 SDK r2 Mac / Examples / Selection / Shape / ShapeUIMac.c < prev   
Encoding:
C/C++ Source or Header  |  1996-09-05  |  2.2 KB  |  99 lines  |  [TEXT/CWIE]

  1. /*
  2.     File: ShapeUIMac.c
  3.  
  4.     Copyright 1996 by Adobe Systems, Inc.
  5.  
  6.     C source file for Mac specific code for Shape example.
  7. */
  8.  
  9. #include "Shape.h"
  10.  
  11. /*****************************************************************************/
  12.  
  13. /* Displays the about dialog box for the plug-in module. */
  14.  
  15. void DoAbout (GPtr globals)
  16. {
  17.     ShowAbout(gStuff->hostSig, AboutID);
  18. }
  19.  
  20. /*****************************************************************************/
  21.  
  22. /* Setup the parameters dialog.  Returns TRUE if it succeeds.                 */
  23.  
  24. Boolean DoParameters (GPtr globals)
  25. {
  26.     
  27.     short         item;
  28.     DialogPtr    dp;
  29.     DialogTHndl    dialogHdl;
  30.     dialogHdl = (DialogTHndl) GetResource ('DLOG', uiID);
  31.     
  32.     if (dialogHdl == NULL || *dialogHdl == NULL)
  33.         return false;
  34.     else
  35.     {
  36.         
  37.     HNoPurge ((Handle) dialogHdl);
  38.  
  39.     CenterDialog (dialogHdl);
  40.     SetUpMoveableModal (dialogHdl, gStuff->hostSig);
  41.     
  42.     dp = GetNewDialog (uiID, nil, (WindowPtr) -1);
  43.         
  44.     /* I am throwing away the results from these routines. 
  45.        Toolbox TechNote 37 does not document what error values they return.
  46.        Also, the worst that happens is that the interface isn't quite right. */
  47.     
  48.     (void) SetDialogDefaultItem (dp, ok);
  49.     (void) SetDialogCancelItem (dp, cancel);
  50.     (void) SetDialogTracksCursor (dp, TRUE);
  51.         
  52.     SetRadioGroupState (dp,
  53.                         kFirstItem,
  54.                         kLastItem,
  55.                         kFirstItem + gWhatShape);
  56.             
  57.     SetRadioGroupState (dp,
  58.                         kCreateRadio1,
  59.                         kCreateRadioLast,
  60.                         kCreateRadio1 + gCreate);
  61.                         
  62.     SelectWindow (dp);
  63.     
  64.     do
  65.         {
  66.         
  67.         MoveableModalDialog (dp, gStuff->processEvent, nil, &item);
  68.  
  69.         if (item >= kFirstItem && item <= kLastItem)
  70.             SetRadioGroupState (dp, kFirstItem, kLastItem, item);
  71.         else if (item >= kCreateRadio1 && item <= kCreateRadioLast)
  72.             SetRadioGroupState (dp, kCreateRadio1, kCreateRadioLast, item);
  73.         }
  74.     while (item != ok && item != cancel);
  75.  
  76.     if (item == ok)
  77.         {
  78.         gWhatShape = GetRadioGroupState(dp, kFirstItem, kLastItem) - kFirstItem;
  79.         gCreate = GetRadioGroupState(dp, kCreateRadio1, kCreateRadioLast) - kCreateRadio1;
  80.         }
  81.     else
  82.         gResult = userCanceledErr;
  83.     
  84.     DisposDialog (dp);
  85.         
  86.     if (dialogHdl != NULL && *dialogHdl != NULL)
  87.         HPurge ((Handle) dialogHdl);
  88.     
  89.     dp = NULL;
  90.     dialogHdl = NULL;
  91.     
  92.     return item == ok;
  93.     
  94.     
  95.     } // else
  96. }
  97.  
  98. /*********************************************************************/
  99.